<template>
  <!-- 只能有一个根标签 -->
  <div class="box">
    <ul>
      <li v-for="item,index in list" :key="index">
        <!-- 父组件不传标签, 默认渲染slot内容 -->
        <!-- 父组件传标签, 渲染父组件传递的标签 -->

        <!-- 作用域插槽,使用方式 ①定义变量 ②在父组件使用slot-scope="{data}" -->
        <slot :data="item">
          <span>{{ item.name }}</span>
        </slot>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: '',
  components: {},
  props: {
    list: {
      type: Array,
      required: true
    }
  },
  data() {
    return {}
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {}
}
</script>

<style scoped>
    .box {
        position: absolute;
        left: 50%;
        transform: translate(-50%);
        z-index: 999999;
        font-size: 30px;
    }
</style>
